﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CRS.Core.DataAccess;
using VitCode.Castle.Helper;

namespace CRS.Web.Reports
{
    public partial class AssetInfoList : System.Web.UI.Page
    {
        private DataTable GetDataSource()
        {
            //                消费项目 货品名称  消费类型  消费时间  数量 单价 单位 金额
            DataTable dt = null;
            var sqlHelper = new SqlHelper();
            var acc = new CoreDataAccess();
            try
            {
                var sql = new StringBuilder("Select '房间消费' 费用项目, 'V101' 房间名称, '可乐' 货品名称, 'VCI0000001' 货品条码,  '收费' 费用类型,  '2011-01-23 22:33:44' 消费时间,  2 数量,  5.00 单价, '听' 单位, 10.00 应收金额, 0.00 折扣金额, 10.00 实收金额, 0.00 支出金额\r\n");
                sql.Append("union Select '房间消费' , 'V101' ,'双喜香烟' , 'VCI0000002' ,  '收费' ,  '2011-01-23 22:33:44' ,  2 ,  10.00 , '包' , 20.00, 0.00, 20.00, 0.00 \r\n");
                sql.Append("union Select '房间消费' , 'V101' ,'怡宝水' , 'VCI0000003' ,  '免费' ,  '2011-01-23 22:33:44' ,  4 , 2.00 , '瓶' , 8.00, 0.00, 8.00, 0.00  \r\n");
                sql.Append("union Select '现金零售' , '' , '怡宝水' , 'VCI0000003' ,  '收费' ,  '2011-01-23 22:33:44' ,  4 , 2.00 , '瓶' , 8.00, 0.00, 8.00, 0.00  \r\n");
                sql.Append("union Select '现金零售' , '' , '清凉茶' , 'VCI0000004' ,   '收费' ,  '2011-01-23 22:33:44' ,  4 , 2.00 , '盒' , 8.00, 0.00, 8.00, 0.00 \r\n");
                sql.Append("union Select '房费' ,   'V101'      ,''         , '' ,          '收费' ,  '2011-01-23 22:33:44' ,  4 , 15.00 , '瓶' , 60.00, 5.00, 60.00, 0.00 \r\n");
                sql.Append("union Select '房费' ,   'V102'      ,''         , '' ,          '收费' ,  '2011-02-23 22:33:44' ,  4 , 15.00 , '瓶' , 60.00, 0.00, 60.00, 0.00 \r\n");
                sql.Append("union Select '进货' ,   '',         '怡宝水',   'VCI0000003',   '支付' ,  '2011-02-23 22:33:44' ,  48 , 1.00 , '瓶' , 0.00, 0.00, 0.00, 48.00 \r\n");
                sql.Append("union Select '进货' ,   '',         '清凉茶' ,  'VCI0000004',   '支付' ,  '2011-02-23 22:33:44' ,  48 , 1.00 , '盒' , 0.00, 0.00, 0.00, 48.00 \r\n");
                dt = acc.GetDataTableBySql(sql.ToString());
            }
            finally
            {
                acc.CloseSession();
            }
            return dt;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                GridView1.DataSource = GetDataSource();
                GridView1.DataBind();
            }
        }
    }
}
